<?php
/**
 * Created by PhpStorm.
 * User: MADAO
 * Date: 2019/11/2
 * Time: 23:00
 */
declare (strict_types=1);

namespace App\Traits;

use Hyperf\Database\Model\Events\Saved;
use Hyperf\Database\Model\Events\Created;
use Hyperf\Database\Model\Events\Updated;
use Hyperf\Database\Model\Events\Deleted;

trait EsSync
{
    public function saved(Saved $event)
    {
        var_dump($event->getModel());
        var_dump('save');
    }

    public function created(Created $event)
    {
        var_dump($event->getModel());
        var_dump('created');
    }

    public function updated(Updated $event)
    {
        var_dump($event->getModel());
        var_dump('updated');
    }

    public function deleted(Deleted $event)
    {
//        $model = $event->getModel();
//        $model->getKey();
        var_dump($event->getModel());
        var_dump('deleted');

    }
}
